<?
	
function geraIcones($pag = 0){
		     
	
	$dir = ("../../icones");
	$ler = opendir($dir);
	while (false !== ($file = readdir($ler))){
	    if (strpos($file, '.gif',1)||strpos($file, '.jpg',1) ||strpos($file, '.png',1) ) {
		$arrNames[] = $file;	
	    } 	
	}
	closedir($ler);
	
	$inicio = $pag*6;
	
	
	for ($i = $inicio ; $i < ($inicio+7); $i++) {
	    
	    ?>
	    
	    <div class="iconeDiv">
		<img class="imgIco" alt="" src="icones/<?=$arrNames[$i]?>" />
		<input class="radio" type="radio" name="icone" value="icones/<?=$arrNames[$i]?>" />
	    </div>
	    <?
	}
	
		    
}

if(isset ($_POST['pagina'])){
    $pagina = $_POST['pagina'];
    if($pagina<0)
	$pagina = 93+$pagina;
    
    geraIcones($pagina);
}

?>
